package com.coollang.smartbra.adapter;

import android.widget.TextView;

import com.chad.library.adapter.base.BaseMultiItemQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.coollang.smartbra.R;
import com.coollang.smartbra.beans.ActionDetailItem;

import java.util.List;

/**
 * @author: Timmy
 * @data: 2017/11/21
 * @Fuction:
 */

public class ActionDetailAdapter extends BaseMultiItemQuickAdapter<ActionDetailItem, BaseViewHolder> {


    public ActionDetailAdapter(List<ActionDetailItem> data) {
        super(data);
        addItemType(ActionDetailItem.DETAILED_DESCRIPTION_HEAD, R.layout.action_detail_1);
        addItemType(ActionDetailItem.DETAILED_DESCRIPTION_CONTENT, R.layout.action_detail_2);
        addItemType(ActionDetailItem.COMMON_MISTAKES, R.layout.action_detail_3);
    }

    @Override
    protected void convert(BaseViewHolder holder, ActionDetailItem item) {

        String text = item.getText();
        switch (holder.getItemViewType()) {
            case ActionDetailItem.DETAILED_DESCRIPTION_HEAD:
                holder.setText(R.id.text, text);
                break;
            case ActionDetailItem.DETAILED_DESCRIPTION_CONTENT:
                holder.setText(R.id.text, text);
                break;
            case ActionDetailItem.COMMON_MISTAKES:
                TextView tvText = holder.getView(R.id.text);
                tvText.setText(text);
                break;
            default:
        }

    }
}



